package mviewer.types;

public class Camera {
	private IVector position, focus, orientation, normal;
	private float zNear, zFar;

	public Camera(IVector position, IVector focus, IVector top, float zNear, float zFar) {
		this.position = position;
		this.focus = focus;
		this.orientation = top;
		VectorData n = new VectorData();
		VectorUtil.sub(focus, position, n);
		VectorUtil.normalize(n, n);
		this.normal = n;
		this.zNear = zNear;
		this.zFar = zFar;
	}

	public Camera(IVector position, float zNear, float zFar) {
		this(position, new VectorData(position.getX(), position.getY(), 0f),
			 new VectorData(0f, 1f, 0f), zNear, zFar);
	}

	public IVector getPosition() {
		return position;
	}

	public IVector getFocus() {
		return focus;
	}

	public IVector getOrientation() {
		return orientation;
	}

	public IVector getNormal() {
		return normal;
	}

	public float getZFar() {
		return zFar;
	}

	public float getZNear() {
		return zNear;
	}

	@Override
	public String toString() {
		return String.format("%s{%s, %s, %s}", getClass().getName(),
							position, focus, orientation);
	}
}
